import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/Login'
import Layout from '@/views/Layout'
import Home from '@/views/Home'
import Search from '@/views/Search'
import News from '@/views/News'
import My from '@/views/My'
import City from '@/views/City'
import Torent from '@/views/Torent'
import Details from '@/views/Details'
import RentName from '@/views/RentName'
import VueBaiduMap from '@/views/VueBaiduMap'
import MyFavorite from '@/views/My/MyFavorite'
import MyTorent from '@/views/My/MyTorent'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/layout'
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/city',
    component: City,
    children: [
      {
        path: 'city/list',
        component: City
      }
    ]
  },
  {
    path: '/layout',
    component: Layout,
    redirect: '/layout/home',
    children: [
      {
        path: 'home',
        component: Home
      },
      {
        path: 'search',
        component: Search
      },
      {
        path: 'news',
        component: News
      },
      {
        path: 'my',
        component: My
      }
    ]
  },
  {
    name: 'torent',
    path: '/torent',
    component: Torent
  },
  {
    path: '/details',
    component: Details
  },
  {
    path: '/rentname',
    component: RentName
  },
  {
    path: '/vueBaiduMap',
    component: VueBaiduMap
  },
  {
    path: '/myFavorite',
    component: MyFavorite
  },
  {
    path: '/MyTorent',
    component: MyTorent
  }
]

const router = new VueRouter({
  routes
})

export default router
